package com.esfak47.mediafetcher.plugin.pornhub.dto;

import com.esfak47.common.utils.StringUtils;
import com.esfak47.mediafetcher.core.domain.FetchAble;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import lombok.Data;

/**
 * Awesome Pojo Generator
 */
@Data
public class PornTubeVideo implements FetchAble {
    @SerializedName("rating")
    @Expose
    private Integer rating;
    @SerializedName("isPrivate")
    @Expose
    private Boolean isPrivate;
    @SerializedName("title")
    @Expose
    private String title;
    @SerializedName("duration")
    @Expose
    private Integer duration;
    @SerializedName("approvedOn")
    @Expose
    private Integer approvedOn;
    @SerializedName("canSeeVideo")
    @Expose
    private Boolean canSeeVideo;
    @SerializedName("premium")
    @Expose
    private Boolean premium;
    @SerializedName("commentsCount")
    @Expose
    private Integer commentsCount;
    @SerializedName("urlThumbnail")
    @Expose
    private String urlThumbnail;
    @SerializedName("id")
    @Expose
    private Integer id;
    @SerializedName("viewCount")
    @Expose
    private Integer viewCount;
    @SerializedName("hd")
    @Expose
    private Boolean hd;
    @SerializedName("vr")
    @Expose
    private Boolean vr;
    @SerializedName("vkey")
    @Expose
    private String vkey;

    public boolean canAccessMedia() {
        return !StringUtils.isBlank(vkey) && !isPrivate && canSeeVideo;
    }

    @Override
    public String getLocation() {
        return "https://www.pornhub.com/view_video.php?viewkey=" + vkey;
    }

    @Override
    public String getType() {
        return "porntube";
    }
}